/**
 * Create by IntelliJ IDEA
 *
 * @author: jsonor
 * @date-Time: 2018/3/30 10:12
 * @description:
 */
public class Test20 {

  public static void main(String[] args) {
    int[] arr = {20, 10, 45, 24, 78, 53, 100, 60};
    System.out.println("元素");
    printlnArry(arr);
    int max = mymax(arr);
    int min = mymin(arr);

    System.out.println("数组中的最大值是:" + max);
    System.out.println("数组中的最小值是:" + min);
  }

  private static int mymin(int[] arr) {
    int min = arr[0];
    for (int i = 1; i < arr.length; i++) {
      if (arr[i] < min) {
        min = arr[i];
      }
    }
    return min;
  }
  private static int mymax(int[] arr) {
    int max = arr[0];
    for (int i = 1; i < arr.length; i++) {
      if (arr[i] > max) {
        max = arr[i];
      }
    }
    return max;
  }

  private static void printlnArry(int[] arr) {
    for (int i = 0; i < arr.length; i++) {
      System.out.print(arr[i] + "\t");
    }
    System.out.println();
  }
}

